#include<iostream>
using namespace std;

#define DEBUG_MOD
#ifdef DEBUG_MOD
#include<bitset>
#define LOG_ADDR(addr) addr.printInfo()

#define LOG_CLASSIFY cout << __LINE__ << ':'

#define LOG_STA(sta) cout << bitset<8>(sta) << endl

#else
#define LOG_ADDR(addr)
#define LOG_CLASSIFY
#define LOG_STA(sta)
#endif // DEBUG_MOD

enum enumSta{
    A = 6, 
    B = 5, 
    C = 4, 
    D = 3, 
    E = 2, 
    ERROR = 1, 
    PRIVATE = 0};

class address
{
private:
    int16_t IPandMark[8] = {0};
    char statue = 0; // A、B、C、D、E、错误、私有
public:    
    address(char *input)
    {
        uint16_t part = 0;
        char* tmpStr = nullptr;
        uint16_t tmpStrLen = 0;
        for (char *pi = input; *pi != 0; pi++)
        {
            if(tmpStrLen == 0) tmpStr = new char[4]{0};
            
            if (*pi != '.' && 
                *pi != '~')
            {
                tmpStr[tmpStrLen++] = *pi;
            }
            else if(tmpStrLen != 0)
            {
                for (char *pj = tmpStr; *pj != 0; pj++)
                {
                    this->IPandMark[part] =  static_cast<int16_t>(this->IPandMark[part]*10) + static_cast<int16_t>(*pj - '0');
                }
                
                part++;
                delete tmpStr;
                tmpStr = nullptr;
                tmpStrLen = 0;
            }
            else
            {
                this->IPandMark[part] = -1;
                part++;
            }
        }
        if(tmpStrLen != 0)
        {
            for (char *pj = tmpStr; *pj != 0; pj++)
            {
                this->IPandMark[part] =  static_cast<int16_t>(this->IPandMark[part]*10) + static_cast<int16_t>(*pj - '0');
            }
            
            part++;
            delete tmpStr;
            tmpStr = nullptr;
            tmpStrLen = 0;
        }
        else
        {
            this->IPandMark[part] = -1;
            part++;
        }
    }
    
    char classify()
    {
        if(IPandMark[0] == 0 ||
           IPandMark[0] == 127) // 忽略
        {
            LOG_CLASSIFY;
            return statue = 0;
        }

        if(IPandMark[0] < 0 ||
            IPandMark[1] < 0 ||
            IPandMark[2] < 0 ||
            IPandMark[3] < 0 ||
            IPandMark[4] < 0 ||
            IPandMark[5] < 0 ||
            IPandMark[6] < 0 ||
            IPandMark[7] < 0) // 小于零则表示为空
        {
            LOG_CLASSIFY;
            return statue | (1 << enumSta::ERROR);
        }

        bool isOne = false;
        if(IPandMark[4] == 0 || IPandMark[7] == 255) // 全0与全1的子网掩码也是错的
        {
            LOG_CLASSIFY;
            return statue | (1 << enumSta::ERROR); // 子网掩码有误
        }
        for (int i = 7; i >= 4; i--)
        {
            uint16_t mark = 1;
            for (int j = 0; j < 8; j++)
            {
                if(!isOne && (IPandMark[i] & mark) != 0)
                {
                        isOne = true;
                }
                else if (isOne && (IPandMark[i] & mark) == 0)
                {
                    LOG_CLASSIFY;
                    return statue | (1 << enumSta::ERROR); // 子网掩码有误
                }
                mark = mark << 1;
            }
        }

        if(IPandMark[0] < 127)
        {
            statue |= (1 << enumSta::A);
            if(IPandMark[0] == 10)
            {
                statue |= (1 << enumSta::PRIVATE);
            }
        }
        else if(IPandMark[0] <= 191)
        {
            statue |= (1 << enumSta::B);
            if(IPandMark[0] == 172)
            {
                if(IPandMark[1] >= 16 &&
                   IPandMark[1] <= 31)
                {
                    statue |= (1 << enumSta::PRIVATE);
                }
            }
        }
        else if(IPandMark[0] <= 223)
        {
            statue |= (1 << enumSta::C);
            if(IPandMark[0] == 192 &&
               IPandMark[1] == 168)
            {
                statue |= (1 << enumSta::PRIVATE);
            }
        }
        else if(IPandMark[0] <= 239) statue |= (1 << enumSta::D);
        else if(IPandMark[0] <= 255) statue |= (1 << enumSta::E);

        LOG_CLASSIFY;
        return statue;
    }
    
#ifdef DEBUG_MOD
    void printInfo()
    {
        cout << this->IPandMark[0] << '.'
            << this->IPandMark[1] << '.'
            << this->IPandMark[2] << '.'
            << this->IPandMark[3] << '~'
            << this->IPandMark[4] << '.'
            << this->IPandMark[5] << '.'
            << this->IPandMark[6] << '.'
            << this->IPandMark[7] << endl;
    }
#endif // DEBUG_MOD
};

void statueAdd(uint16_t *statueArr, char statue)
{
    for(int i = 0; i < 7; i++)
    {
        if(statue & (1 << i))
        {
            statueArr[6-i] += 1;
        }
    }
}

int main()
{
    char input[32] = {0};
    uint16_t statueArr[7] = {0};
    while (cin >> input)
    {
        address adr(input);
        LOG_ADDR(adr);
        char statue = adr.classify();
        LOG_STA(statue);
        statueAdd(statueArr, statue);
    }
    cout << statueArr[0] << ' '
         << statueArr[1] << ' '
         << statueArr[2] << ' '
         << statueArr[3] << ' '
         << statueArr[4] << ' '
         << statueArr[5] << ' '
         << statueArr[6] << endl;
    
    return 0;
}